#include "mainscene.h"
#include "ui_mainscene.h"
#include<QPainter>
mainscene::mainscene(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::mainscene)
{
    ui->setupUi(this);

    //配置主场景

    //设置页面固定大小
    setFixedSize(430,590);

    //设置图标
    setWindowIcon(QIcon(":/new/prefix1/pic/coind.png"));

    //设置标题
    setWindowTitle("别管我啦爱玩不玩");

    //退出按钮的实现
    connect(ui->actionquit,&QAction::triggered,[=](){
        this->close();
    });
}


void mainscene::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/new/prefix1/pic/yml.jpg");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);


    //画背景上的图标
    pix.load(":/new/prefix1/pic/bear.jpg");

    //缩放图标的代码
    pix= pix.scaled(pix.width() *0.5 , pix.height() *0.5);
    painter.drawPixmap(0,20,pix);
}



mainscene::~mainscene()
{
    delete ui;
}
